PROP_0,
PROP_FRACTION,
PROP_PULSE_STEP,
- PROP_ORIENTATION,
PROP_INVERTED,
PROP_TEXT,
PROP_SHOW_TEXT,
- PROP_ELLIPSIZE
+ PROP_ELLIPSIZE,
+ PROP_ORIENTATION,
+ NUM_PROPERTIES = PROP_ORIENTATION
};
+static GParamSpec *progress_props[NUM_PROPERTIES] = { NULL, };
+
static void gtk_progress_bar_set_property (GObject *object,
guint prop_id,
const GValue *value,
g_object_class_override_property (gobject_class, PROP_ORIENTATION, "orientation");
- g_object_class_install_property (gobject_class,
- PROP_INVERTED,
- g_param_spec_boolean ("inverted",
- P_("Inverted"),
- P_("Invert the direction in which the progress bar grows"),
- FALSE,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (gobject_class,
- PROP_FRACTION,
- g_param_spec_double ("fraction",
- P_("Fraction"),
- P_("The fraction of total work that has been completed"),
- 0.0, 1.0, 0.0,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (gobject_class,
- PROP_PULSE_STEP,
- g_param_spec_double ("pulse-step",
- P_("Pulse Step"),
- P_("The fraction of total progress to move the bouncing block when pulsed"),
- 0.0, 1.0, 0.1,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (gobject_class,
- PROP_TEXT,
- g_param_spec_string ("text",
- P_("Text"),
- P_("Text to be displayed in the progress bar"),
- NULL,
- GTK_PARAM_READWRITE));
+ progress_props[PROP_INVERTED] =
+ g_param_spec_boolean ("inverted",
+ P_("Inverted"),
+ P_("Invert the direction in which the progress bar grows"),
+ FALSE,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ progress_props[PROP_FRACTION] =
+ g_param_spec_double ("fraction",
+ P_("Fraction"),
+ P_("The fraction of total work that has been completed"),
+ 0.0, 1.0,
+ 0.0,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ progress_props[PROP_PULSE_STEP] =
+ g_param_spec_double ("pulse-step",
+ P_("Pulse Step"),
+ P_("The fraction of total progress to move the bouncing block when pulsed"),
+ 0.0, 1.0,
+ 0.1,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ progress_props[PROP_TEXT] =
+ g_param_spec_string ("text",
+ P_("Text"),
+ P_("Text to be displayed in the progress bar"),
+ NULL,
+ GTK_PARAM_READWRITE);
/**
* GtkProgressBar:show-text:
*
* Since: 3.0
*/
- g_object_class_install_property (gobject_class,
- PROP_SHOW_TEXT,
- g_param_spec_boolean ("show-text",
- P_("Show text"),
- P_("Whether the progress is shown as text."),
- FALSE,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
+ progress_props[PROP_SHOW_TEXT] =
+ g_param_spec_boolean ("show-text",
+ P_("Show text"),
+ P_("Whether the progress is shown as text."),
+ FALSE,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkProgressBar:ellipsize:
*
* Since: 2.6
*/
- g_object_class_install_property (gobject_class,
- PROP_ELLIPSIZE,
- g_param_spec_enum ("ellipsize",
- P_("Ellipsize"),
- P_("The preferred place to ellipsize the string, if the progress bar "
- "does not have enough room to display the entire string, if at all."),
- PANGO_TYPE_ELLIPSIZE_MODE,
- PANGO_ELLIPSIZE_NONE,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
+ progress_props[PROP_ELLIPSIZE] =
+ g_param_spec_enum ("ellipsize",
+ P_("Ellipsize"),
+ P_("The preferred place to ellipsize the string, if the progress bar "
+ "does not have enough room to display the entire string, if at all."),
+ PANGO_TYPE_ELLIPSIZE_MODE,
+ PANGO_ELLIPSIZE_NONE,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ g_object_class_install_properties (gobject_class, NUM_PROPERTIES, progress_props);
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("xspacing",
gtk_progress_bar_set_activity_mode (pbar, FALSE);
gtk_widget_queue_draw (GTK_WIDGET (pbar));
- g_object_notify (G_OBJECT (pbar), "fraction");
+ g_object_notify_by_pspec (G_OBJECT (pbar), progress_props[PROP_FRACTION]);
}
static void
gtk_widget_queue_resize (GTK_WIDGET (pbar));
- g_object_notify (G_OBJECT (pbar), "text");
+ g_object_notify_by_pspec (G_OBJECT (pbar), progress_props[PROP_TEXT]);
}
/**
gtk_widget_queue_resize (GTK_WIDGET (pbar));
- g_object_notify (G_OBJECT (pbar), "show-text");
+ g_object_notify_by_pspec (G_OBJECT (pbar), progress_props[PROP_SHOW_TEXT]);
}
}
priv->pulse_fraction = fraction;
- g_object_notify (G_OBJECT (pbar), "pulse-step");
+ g_object_notify_by_pspec (G_OBJECT (pbar), progress_props[PROP_PULSE_STEP]);
}
static void
gtk_widget_queue_resize (GTK_WIDGET (pbar));
- g_object_notify (G_OBJECT (pbar), "inverted");
+ g_object_notify_by_pspec (G_OBJECT (pbar), progress_props[PROP_INVERTED]);
}
}
{
priv->ellipsize = mode;
- g_object_notify (G_OBJECT (pbar), "ellipsize");
+ g_object_notify_by_pspec (G_OBJECT (pbar), progress_props[PROP_ELLIPSIZE]);
gtk_widget_queue_resize (GTK_WIDGET (pbar));
}
}